<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <div id="app">
            <com>
                <!-- 具名插槽 -->
                <template v-slot:hello>
                    <span>Hello</span>
                    <span>World</span>
                </template> 
                <!-- 作用域插槽 -->
                <!-- <template v-slot:default="obj">{{obj.a}}</template> -->
                <template v-slot="obj">{{obj.a}}</template>
                <!-- <template v-slot:header>haha</template> -->
            </com>
        </div>
        <template id="com">
            <div>
                <!-- <slot v-bind:msg="msg"></slot> -->
                <!-- <slot></slot> -->
                <slot name="hello"></slot>
                <slot :a="msg"></slot>
                <!-- <slot name="header"></slot> -->
                <button>{{msg}}</button>
            </div>
        </template>
        <script src="../vue.js"></script>
        <script>
            let com = {
                template: '#com',
                data() {
                    return {
                        msg: '按钮',
                    };
                },
            };
            new Vue({
                el: '#app',
                data() {
                    return {
                        // msg: 'hello',
                    };
                },
                components: {
                    com,
                },
            });
        </script>
    </body>
</html>
